package com.xuhai.blog19.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuhai.blog19.admin.dao.ArticleCategoryDao;
import com.xuhai.blog19.admin.entity.ArticleCategoryEntity;
import com.xuhai.blog19.admin.entity.ArticleEntity;
import com.xuhai.blog19.admin.service.ArticleCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author PangJunjie
 * @Date 2023/2/8/008
 */
@Service
public class ArticleCategoryServiceImpl extends ServiceImpl<ArticleCategoryDao, ArticleCategoryEntity> implements ArticleCategoryService {
    @Autowired
    private ArticleCategoryDao articleCategoryDao;

    @Override
    public List<ArticleEntity> getCategoryByCategoryId(int categoryId) {
        return articleCategoryDao.getArticleByCategoryId(categoryId);
    }

    @Override
    public void deleteByArticleId(int articleId) {
        this.remove(new QueryWrapper<ArticleCategoryEntity>().eq("article_id", articleId));
    }
}
